package edu.jd.movieplatform.user.info.dao;

import edu.jd.movieplatform.user.info.UserInfo;
import edu.jd.movieplatform.user.info.UserInfoDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserInfoDao {

    @Select("select cust_username, avatar_address, phone_number from customer " +
            "where cust_username = #{cust_username}")
    public UserInfo getUserInfoByUsername(String cust_username);

    @Update("update customer set phone_number = #{phone_number} " +
            "where cust_username = #{username}")
    public void updateInfo(UserInfoDto userInfoDto);

    @Select("select password from customer where cust_username = #{username}")
    public String checkPassword(String username);

    @Update("update customer set password = #{newPassword} " +
            "where cust_username = #{username}")
    public void updatePassword(@Param("username") String username, @Param("newPassword") String newPassword);
}
